﻿<%@ page language=
"java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<%@ include file="/include/include.jsp" %>

</head>

<body>
	
	<%@ include file="/include/header.jsp" %>

	<%@ include file="/include/menu.jsp" %>
	
	<script>
		function exportPurchase(){
			if(!isSelected('idss')){
				alert('您必须选择一行！');
				return;
			}
			
			$('ids').value=getValuesByTagName('idss');
			$('form').action ='${ctx}/purchase/purchaselist/exportpurchase';
			$('form').submit();
			
		}

		function deletePurchase(id){
			if (!isSelected('idss')){
				alert("您必须选择一行!");
				return;
			}

			if (window.confirm("您确认要删除您所选择的订单信息？订单信息一旦被删除则不能够恢复")) {
				$('ids').value = getValuesByTagName('idss');
				$('form').action = "${ctx}/purchase/purchaselist/deletes";
				$('currPageId').value = document.getElementsByName('page.currentPage')[0].value;
				$('form').submit();
			}
		}

		function deletePurchaseOrder(id){
			if (window.confirm("您确认要删除您所选择的订单信息？订单信息一旦被删除则不能够恢复")) {
				$('form').action = "${ctx}/purchase/purchaselist/delete/" + id;
				$('currPageId').value = document.getElementsByName('page.currentPage')[0].value;
				$('form').submit();
			}
		}
		function deletePurchaseOrder2(id){
			if (window.confirm("是否置为完成状态?")) {
				$('form').action = "${ctx}/purchase/purchaselist/finish/"+id;
				$('currPageId').value = document.getElementsByName('page.currentPage')[0].value;
				$('form').submit();
			}
		}
</script>
	<form id='form'  method="post">
		<input type="hidden" name="ids" id='ids' />
		<input  type = "hidden" id = "currPageId" name = "currPageId" />
	</form>
	<div id="mainContent">
		<h2><a href="${ctx}/${menu.url}">${menu.description}</a>&nbsp;-&nbsp;<a href="${ctx}/${empty currViewBarSubMenu_ ? submenu.url : currViewBarSubMenu_.url}">${empty currViewBarSubMenu_ ? submenu.description : currViewBarSubMenu_.description}</a></h2>
		
		<div class="tool-bar">
			<div title="${menu.description} - ${submenu.description} - 导入${submenu.description}"  href="${ctx}/purchase/purchaselist/import" class="modal-window modal-link">导入${submenu.description}</div>
			<%-- <a href="${ctx}/purchase/purchaselist/export" >导出${submenu.description}</a> --%>
			<a href="javascript:exportPurchase()" >导出${submenu.description}</a>
			<div title="${menu.description} - ${empty currViewBarSubMenu_ ? submenu.description : currViewBarSubMenu_.description} - 查询${empty currViewBarSubMenu_ ? submenu.description : currViewBarSubMenu_.description}"  href="${ctx}/purchase/purchaselist/search" class="modal-window modal-link">过滤查询</div>
			<a href="${ctx}/purchase/purchaselist/list/compositor" >默认排序</a>
			<a href="${ctx}/purchase/purchaselist/list/redcompositor" >红色置顶</a>
			<a href="javascript:deletePurchase(${po.id});" >删除订单</a>
		</div>
		<div id="ajax2">
		</div>
		<c:if test="${not empty infoMessage}">
			<div class="info">
				<span>		
					${infoMessage}
				</span>
			</div>
		</c:if>	
		<div class="grid-list">
			<table class="grid" cellspacing="0" url="${ctx}/purchase/purchaselist/list">
				<thead>
					<tr>
						<td><input type="checkbox" name="aaa" onclick="clearAll(this,'idss')"/></td>
						<td orderBy_="purchaseorder.orderNumber" class="${orderParameters['purchaseorder.orderNumber']}">PO单号</td>
						<td orderBy_="purchaseorder.maintenanceStation.number" class="${orderParameters['purchaseorder.maintenanceStation.number']}">ASC代码</td>
						<td orderBy_="purchaseorder.maintenanceStation.name" class="${orderParameters['purchaseorder.maintenanceStation.name']}">ASC简称</td>
						<td orderBy_="purchaseorder.maintenanceStation.region.name" class="${orderParameters['purchaseorder.maintenanceStation.region.name']}">区域</td>
						<td orderBy_="purchaseorder.orderDate" class="${orderParameters['purchaseorder.orderDate']}">订单日期</td>
						<td>DO单号</td>
						<td>操作</td>
						<!--<td>百分比</td>
					--></tr>
				</thead>
				<tbody>
					<c:forEach var="po" items="${purchaseOrders}">
						<tr onmouseover="this.style.backgroundColor= '#A0CFEC'" onmouseout="this.style.backgroundColor= '#ffffff'" ${po.percentage < 100 ? 'class="err"' : '' }>
							<td><input type="checkbox" name="idss"  value="${po.id}"/></td>
							<td><a href="${ctx}/purchase/purchasedetails/${po.id}" >${po.orderNumber}</a></td>
							<td>${po.maintenanceStation.number}</td>
							<td>${po.maintenanceStation.name}</td>
							<td>${po.maintenanceStation.region.name }</td>
							<td>
								<c:if test="${po.orderDate!=null}">
									<fmt:formatDate value="${po.orderDate}" pattern="yyyy-MM-dd"/>
								</c:if>
							</td>
							<td>
							</td>
							<td  class="tool-bar-tr">
								<c:if test="${po.percentage == null || po.percentage < 100}">
									<a href="javascript:deletePurchaseOrder2(${po.id});" >
										<img width="16" height="16" border="0" title="置为完成状态" src="${ctx}/static/images/finish.png"  alt="" />
									</a>
								</c:if>
								
								<a href="javascript:deletePurchaseOrder(${po.id});" >
										<img width="16" height="16" border="0" title="删除订单" src="${ctx}/static/images/delete.png"  alt="" />
								</a>
							</td>
							</tr>
						
					
					</c:forEach>
				</tbody>
			</table>
			<t:page action="${ctx}/purchase/purchaselist/list" />
		</div>
	</div>
	<%@ include file="/include/script.jsp" %>
	
</body>

</html> 